package com.bestcem.xm.award.controller.dto;

import com.bestcem.xm.award.constant.AwardAwardConstants;
import com.bestcem.xm.award.constant.Constants;
import com.bestcem.xm.common.core.constant.RegTypes;
import lombok.*;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * 抽奖奖项兑奖码数据DTO
 * @author sh.pei <sh.pei@idiaoyan.com>
 * @version v3.0
 * @date 2021/8/18 13:38
 */
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
public class AwardWinDTO implements Serializable {

    /**
     * Required. 兑奖码
     */
    @NotBlank(message = "兑奖码缺失")
    @Pattern(regexp = RegTypes.AWARD_CODE, message = AwardAwardConstants.DRAW_CODE_FORMAT_ERROR)
    @Length(max = Constants.DrawAwardParamsRule.AWARD_WIN_CODE_MAX_LENGTH,
            message = Constants.DrawAwardParamsRule.AWARD_WIN_CODE_TOO_LONG_MESSAGE)
    private String code;

    /**
     * Required. 奖项名称
     */
    @NotBlank(message = "上传兑奖码奖项名称缺失")
    private String name;

    /**
     * Required. 奖励等级
     */
    @NotNull(message = "上传兑奖码奖项等级缺失")
    @Min(value = 0, message = "上传兑奖码奖项等级错误")
    @Max(value = 8, message = "上传兑奖码奖项等级错误")
    private Integer level;
}
